/*
package com.heima.common.config;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@ConfigurationProperties(prefix = "snowflake")
@Data
public class CustomIdGenerator implements IdentifierGenerator {

    */
/** 数据中心 ID（0~31） *//*

    private long datacenterId = 1L;

    */
/** 机器 ID（0~31） *//*

    private long workerId = 1L;

    private Sequence sequence;

    // Spring 会在属性注入完成后调用
    @javax.annotation.PostConstruct
    public void init() {
        this.sequence = new Sequence(workerId, datacenterId);
        log.info("Snowflake ID Generator initialized: datacenterId={}, workerId={}", datacenterId, workerId);
    }

    @Override
    public Long nextId(Object entity) {
        return sequence.nextId();
    }

    // setter 方法供 @ConfigurationProperties 注入
    public void setDatacenterId(long datacenterId) {
        this.datacenterId = datacenterId;
    }

    public void setWorkerId(long workerId) {
        this.workerId = workerId;
    }
}
*/
